﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data.Linq;
using System.Data.Linq.Mapping;
using System.Linq;
using System.Text;

namespace DomainModel.Entities
{
    [Table(Name = "Stores")]
    public class Store : IDataErrorInfo
    {
        [Column(Name = "storeID", IsPrimaryKey = true, IsDbGenerated = true, AutoSync = AutoSync.OnInsert)]
        public int StoreID { get; set; }

        [Column(Name = "name")]
        public string Name { get; set; }

        public string this[string fieldName]
        {
            get
            {
                if ((fieldName == "Name") && string.IsNullOrEmpty(Name))
                    return "Store name must not be empty.";

                return null;
            }
        }

        public string Error { get { return null; } }//Not actually needed, but necessary to implement IDataErrorInfo
    }
}
